package com.yuanfeng.activity.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yuanfeng.activity.dto.CommonIsXianUpdateDTO;
import com.yuanfeng.activity.dto.DiscountBaseAddParamDTO;
import com.yuanfeng.activity.dto.DiscountBaseListQueryDTO;
import com.yuanfeng.activity.dto.FinishBaseListQueryDTO;
import com.yuanfeng.activity.entity.ActivityDiscountBaseEntity;
import com.yuanfeng.activity.vo.*;
import com.yuanfeng.commoms.dto.goods.ListPageQueryParamDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @ClassName ActivityDiscountBaseMapper
 * @Description 限时折扣活动表
 * @Author cyp
 * @Date 2023-05-30 18:05:20
 * @Version 1.0
 **/
@Mapper
public interface ActivityDiscountBaseMapper extends BaseMapper<ActivityDiscountBaseEntity> {

    /**
     * 查询折扣信息
     * @param goodsId
     * @return
     */
    CheckDiscountLimitVO queryDiscountInfo(@Param("goodsId")Integer goodsId);

    /**
     * 查询商品数量
     * @param param
     * @return
     */
    Integer queryOrderGoodsCount(@Param("param")Map<String, Object> param);

    /**
     *  查询所有 限时折扣商品
     * @param page
     * @param param
     * @return
     */
    IPage<Map<String, Object>> queryAllZheKou(IPage<Map<String, Object>> page, @Param("param") ListPageQueryParamDTO param);

    /**
     * 查询限时折扣活动列表
     * @param param
     * @return
     */
    List<DiscountBaseListVO> selectDiscountBaseList(@Param("param") DiscountBaseListQueryDTO param);

    /**
     * 查询限时折扣活动列表的总数
     * @param param
     * @return
     */
    Integer selectDiscountBaseListCount(@Param("param")DiscountBaseListQueryDTO param);

    /**
     * 删除
     * @param discountId
     * @return
     */
    int deleteByPrimaryKey(Integer discountId);

    /**
     * 插入限时折扣活动表
     * @param param
     */
    void insertDiscountBase(@Param("param") DiscountBaseAddParamDTO param);

    /**
     * 查询店铺活动详情
     * @param discountId
     * @return
     */
    DiscountBaseDetailResultVO selectDiscountBaseDetail2(@Param("discountId")Integer discountId);

    /**
     * 修改
     * @param param
     */
    void updateDiscountBase(@Param("param")DiscountBaseAddParamDTO param);

    /**
     * 修改goods_common的促销
     * @param param
     */
    void updateCommonIsXian3(@Param("param") CommonIsXianUpdateDTO param);

    /**
     * 装修 限时折扣列表查询
     * @param param
     * @return
     */
    IPage<Map<String,Object>> selectFinishBaseList(IPage<Map<String,Object>> page,@Param("param") FinishBaseListQueryDTO param);

    /**
     * 查询当前活动详情
     * @param discountId
     * @return
     */
    DiscountBaseDetailVO selectDiscountBaseDetail(@Param("discountId")Integer discountId);

    /**
     * 查询活动id和活动名
     * @param discountId
     * @return
     */
    Map<String, Object> queryDiscountBase(@Param("discountId")Integer discountId);


    /**
     * 分页查询平台折扣基本列表
     *
     * @param page
     * @param param
     * @return
     */
    IPage<DiscountBaseListVO> queryPlatformDiscountBaseList(IPage<DiscountBaseListVO> page, @Param("param") DiscountBaseListQueryDTO param);


    /**
     * 分页查询活动商品信息
     * @param page
     * @param param
     * @return
     */
    IPage<DiscountGoodsListVO> selectDiscountGoodsDetail(IPage<DiscountGoodsListVO> page , @Param("param") Map<String, Object> param);
}
